package com.kkyy.findmusic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kkyy.findmusic.dao.SongsDao;
import com.kkyy.findmusic.entity.SongsEntity;
import com.kkyy.findmusic.service.SongsService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SongsServiceImpl extends ServiceImpl<SongsDao, SongsEntity> implements SongsService {
    @Override
    public List<SongsEntity> getSongs() {
        List<SongsEntity> songs = this.baseMapper.selectByStatus();
        return songs;
    }

    @Override
    public SongsEntity getOneById(Integer songId) {
        SongsEntity song = this.baseMapper.selectById(songId);
        return song;
    }

    @Override
    public void delSongById(Integer id) {
        this.baseMapper.updateSongStatus(id);
    }

    @Override
    public void downSongById(Integer id) {
        baseMapper.updateDownSongType(id);
    }

    @Override
    public void upSongById(Integer id) {
        baseMapper.updateUpSongType(id);
    }

    @Override
    public List<SongsEntity> getSongs2() {
        List<SongsEntity> songs = this.baseMapper.selectByStatus2();
        return songs;
    }

    @Override
    public void addSongInfo(String songname, String songart, String picurl, Integer location) {
        baseMapper.addSongInfo(songname, songart, picurl, location);
    }
}